package com.rankeiot.core.excel;

import java.util.ArrayList;
import java.util.List;

public class Relationship
{
    private final String rootFolder;
    private final List<String> targetList;
    private final List<String> typeList;
    private final List<String> idList;
    private int currentId;

    /**
     * Gets the root folder of the relationship
     * @return Root folder of the relationship
     */
    String getRootFolder() {
        return rootFolder;
    }

    /**
     * Gets the list of targets
     * @return ArrayList of targets as strings
     */
    List<String> getTargetList() {
        return targetList;
    }

    /**
     * Gets the list of types
     * @return ArrayList of types as strings
     */
    List<String> getTypeList() {
        return typeList;
    }

    /**
     * Gets the list of IDs (rId...)
     * @return ArrayList of IDs as strings
     */
    List<String> getIdList() {
        return idList;
    }

    /**
     * Constructor with definition of the root folder
     * @param path Root folder of the relationship
     */
    Relationship(String path)
    {
        this.idList = new ArrayList<>();
        this.targetList = new ArrayList<>();
        this.typeList = new ArrayList<>();
        this.rootFolder = path;
        this.currentId = 1;
    }

    public int getCurrentId() {
        return currentId;
    }

    /**
     * Adds a relationship entry to the relationship
     * @param target Target of the entry
     * @param type Type of the entry
     */
    public void addRelationshipEntry(String target, String type)
    {
        this.targetList.add(target);
        this.typeList.add(type);
        String id = "rId" + this.currentId;
        this.idList.add(id);
        this.currentId++;
    }
}
